modelbutton: Explicitly set up LABELLED-By relation
authorMatthias Clasen <mclasen@redhat.com>
Mon, 26 Oct 2020 12:21:52 +0000 (08:21 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 27 Oct 2020 02:48:01 +0000 (22:48 -0400)
GTK does this automatically based on mnemonics, but only
if the string actually contains a mnemonic. This makes
orca read out menuitems, as expected.

gtk/gtkmodelbutton.c

index 31d0bf10c56417a04a493622ae2bf5b49bb7c3f8..4e4815fdc609cbf37ab948f3e4aad3940ed1d7c6 100644 (file)
@@ -681,6 +681,11 @@ gtk_model_button_set_text (GtkModelButton *button,
   gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label),
                                     text ? text : "");
   update_visibility (button);
+
+  gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
+                                  GTK_ACCESSIBLE_RELATION_LABELLED_BY, g_list_append (NULL, button->label),
+                                  -1);
+
   g_object_notify_by_pspec (G_OBJECT (button), properties[PROP_TEXT]);
 }